/**
 * Copyright &copy; 2015-2020 <a href="http://www.easyhis.com/">easyhis</a> All rights reserved.
 */
package com.easy.dfcapi.entity;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

import com.easy.common.utils.IdGen;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.easy.modules.sys.entity.User;

import com.easy.core.persistence.DataEntity;
import com.easy.common.utils.excel.annotation.ExcelField;

/**
 * 商品信息Entity
 * @author waylen chi
 * @version 2018-01-17
 */
public class ApiProduct extends DataEntity<ApiProduct> {
	
	private static final long serialVersionUID = 1L;
	private Integer productId;		// product_id
	private String id;		// id
	private String productNo;		// 商品货号
	private String productName;		// 商品名称
	private String productNameStyle;		// 商品名称显示的样式；包括颜色和字体样式；
	private Integer storeId;		// 所属店铺ID（外键store）
	private Integer brandId;		// 所属品牌ID（外键Brand）
	private Integer cateId;		// 商品类别ID
	private String unit;		// 计量单位
	private String supportRetail;		// 0-支持零售、1-支持按手销售
	private BigDecimal price;		// 价格/每一计量单位
	private BigDecimal minSalePrice;		// 历史最低价格
	private BigDecimal maxSalePrice;		// 历史最高价格
	private Integer ageGroup;		// 年龄段
	private String keywords;		// 商品关键字，放在商品页的关键字中，为搜索引擎收录用
	private String productAddress;		// 产地
	private String productBrief;		// 商品的简短描述
	private String productDesc;		// 商品的详细描述
	private Integer productThumb;		// 商品在前台显示的微缩图片id，如在分类筛选时显示的小图片
	private String productThumbUrl;		// 商品在前台显示的微缩图片id，如在分类筛选时显示的小图片URL
	private Integer productImg;		// 商品的实际大小图片，如进入该商品页时介绍商品属性所显示的大图片
	private String productImgUrl;		// 商品的实际大小图片，如进入该商品页时介绍商品属性所显示的大图片URL
	private BigDecimal warnNumber;		// 商品报警数量
	private Integer isOnSale;		// 该商品是否开放销售，1，是；0，放入仓库 2-管理员下架
	private Integer isAloneSale;		// 是否能单独销售，1，是；0，否；如果不能单独销售，则只能作为某商品的配件或者赠品销售
	private Integer isVirtual;		// 是否虚拟商品 0-实体，1-虚拟
	private String orginPlace;		// 商品原产地
	private BigDecimal unitSize;		// 单位尺寸
	private String sizeDesc;		// 外观尺寸描述
	private BigDecimal unitWeight;		// 单位重量
	private String weightDesc;		// 商品重量描述
	private Integer supportArrears;		// 是否支持欠款默认0
	private Integer deliveryTime;		// 承诺的发货时间
	private Integer returnTime;		// 承诺的退货时间
	private Integer changeTime;		// 承诺的换货时间
	private Date saleTime;		// 定时上架时间
	private Date offTime;		// 到期下架时间
	private Integer integral;		// 默认0,相应积分数
	private String sellerNote;		// 商品商家备注，仅商家可见
	private Integer sortNo;		// 排序号
	private Date createTime;		// 创建时间
	private User createBy;		// 创建者
	private Date updateTime;		// 更新时间
	private User updateBy;		// 更新者
	private Integer delFlag;		// 删除标志

	
	public ApiProduct() {
		super();
	}

	public ApiProduct(String id){
		this.id = id;
	}

	@NotNull(message="product_id不能为空")
	@ExcelField(title="product_id", align=2, sort=0)
	public Integer getProductId() {
		return productId;
	}

	public void setProductId(Integer productId) {
		this.productId = productId;
	}
	
	@ExcelField(title="id", align=2, sort=1)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	@ExcelField(title="商品货号", align=2, sort=2)
	public String getProductNo() {
		return productNo;
	}

	public void setProductNo(String productNo) {
		this.productNo = productNo;
	}
	
	@ExcelField(title="商品名称", align=2, sort=3)
	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}
	
	@ExcelField(title="商品名称显示的样式；包括颜色和字体样式；", align=2, sort=4)
	public String getProductNameStyle() {
		return productNameStyle;
	}

	public void setProductNameStyle(String productNameStyle) {
		this.productNameStyle = productNameStyle;
	}
	
	@ExcelField(title="所属店铺ID（外键store）", align=2, sort=5)
	public Integer getStoreId() {
		return storeId;
	}

	public void setStoreId(Integer storeId) {
		this.storeId = storeId;
	}
	
	@ExcelField(title="所属品牌ID（外键Brand）", align=2, sort=6)
	public Integer getBrandId() {
		return brandId;
	}

	public void setBrandId(Integer brandId) {
		this.brandId = brandId;
	}
	
	@ExcelField(title="商品类别ID", align=2, sort=7)
	public Integer getCateId() {
		return cateId;
	}

	public void setCateId(Integer cateId) {
		this.cateId = cateId;
	}
	
	@ExcelField(title="计量单位", align=2, sort=8)
	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}
	
	@ExcelField(title="0-支持零售、1-支持按手销售", align=2, sort=9)
	public String getSupportRetail() {
		return supportRetail;
	}

	public void setSupportRetail(String supportRetail) {
		this.supportRetail = supportRetail;
	}
	
	@ExcelField(title="价格/每一计量单位", align=2, sort=10)
	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}
	
	@ExcelField(title="历史最低价格", align=2, sort=11)
	public BigDecimal getMinSalePrice() {
		return minSalePrice;
	}

	public void setMinSalePrice(BigDecimal minSalePrice) {
		this.minSalePrice = minSalePrice;
	}
	
	@ExcelField(title="历史最高价格", align=2, sort=12)
	public BigDecimal getMaxSalePrice() {
		return maxSalePrice;
	}

	public void setMaxSalePrice(BigDecimal maxSalePrice) {
		this.maxSalePrice = maxSalePrice;
	}

	public Integer getAgeGroup() {
		return ageGroup;
	}

	public void setAgeGroup(Integer ageGroup) {
		this.ageGroup = ageGroup;
	}

	@ExcelField(title="商品关键字，放在商品页的关键字中，为搜索引擎收录用", align=2, sort=13)
	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}
	
	@ExcelField(title="产地", align=2, sort=14)
	public String getProductAddress() {
		return productAddress;
	}

	public void setProductAddress(String productAddress) {
		this.productAddress = productAddress;
	}
	
	@ExcelField(title="商品的简短描述", align=2, sort=15)
	public String getProductBrief() {
		return productBrief;
	}

	public void setProductBrief(String productBrief) {
		this.productBrief = productBrief;
	}
	
	@ExcelField(title="商品的详细描述", align=2, sort=16)
	public String getProductDesc() {
		return productDesc;
	}

	public void setProductDesc(String productDesc) {
		this.productDesc = productDesc;
	}
	
	@ExcelField(title="商品在前台显示的微缩图片id，如在分类筛选时显示的小图片", align=2, sort=17)
	public Integer getProductThumb() {
		return productThumb;
	}

	public void setProductThumb(Integer goodsThumbid) {
		this.productThumb = productThumb;
	}

	public String getProductThumbUrl() {
		return productThumbUrl;
	}

	public void setProductThumbUrl(String productThumbUrl) {
		this.productThumbUrl = productThumbUrl;
	}

	@ExcelField(title="商品的实际大小图片，如进入该商品页时介绍商品属性所显示的大图片", align=2, sort=18)
	public Integer getProductImg() {
		return productImg;
	}

	public void setProductImg(Integer productImg) {
		this.productImg = productImg;
	}

	public String getProductImgUrl() {
		return productImgUrl;
	}

	public void setProductImgUrl(String productImgUrl) {
		this.productImgUrl = productImgUrl;
	}

	@ExcelField(title="商品报警数量", align=2, sort=19)
	public BigDecimal getWarnNumber() {
		return warnNumber;
	}

	public void setWarnNumber(BigDecimal warnNumber) {
		this.warnNumber = warnNumber;
	}
	
	@ExcelField(title="该商品是否开放销售，1，是；0，放入仓库 2-管理员下架", align=2, sort=20)
	public Integer getIsOnSale() {
		return isOnSale;
	}

	public void setIsOnSale(Integer isOnSale) {
		this.isOnSale = isOnSale;
	}
	
	@ExcelField(title="是否能单独销售，1，是；0，否；如果不能单独销售，则只能作为某商品的配件或者赠品销售", align=2, sort=21)
	public Integer getIsAloneSale() {
		return isAloneSale;
	}

	public void setIsAloneSale(Integer isAloneSale) {
		this.isAloneSale = isAloneSale;
	}
	
	@ExcelField(title="是否虚拟商品 0-实体，1-虚拟", align=2, sort=22)
	public Integer getIsVirtual() {
		return isVirtual;
	}

	public void setIsVirtual(Integer isVirtual) {
		this.isVirtual = isVirtual;
	}
	
	@ExcelField(title="商品原产地", align=2, sort=23)
	public String getOrginPlace() {
		return orginPlace;
	}

	public void setOrginPlace(String orginPlace) {
		this.orginPlace = orginPlace;
	}
	
	@ExcelField(title="单位尺寸", align=2, sort=24)
	public BigDecimal getUnitSize() {
		return unitSize;
	}

	public void setUnitSize(BigDecimal unitSize) {
		this.unitSize = unitSize;
	}
	
	@ExcelField(title="外观尺寸描述", align=2, sort=25)
	public String getSizeDesc() {
		return sizeDesc;
	}

	public void setSizeDesc(String sizeDesc) {
		this.sizeDesc = sizeDesc;
	}
	
	@ExcelField(title="单位重量", align=2, sort=26)
	public BigDecimal getUnitWeight() {
		return unitWeight;
	}

	public void setUnitWeight(BigDecimal unitWeight) {
		this.unitWeight = unitWeight;
	}
	
	@ExcelField(title="商品重量描述", align=2, sort=27)
	public String getWeightDesc() {
		return weightDesc;
	}

	public void setWeightDesc(String weightDesc) {
		this.weightDesc = weightDesc;
	}
	
	@ExcelField(title="是否支持欠款默认0", align=2, sort=28)
	public Integer getSupportArrears() {
		return supportArrears;
	}

	public void setSupportArrears(Integer supportArrears) {
		this.supportArrears = supportArrears;
	}
	
	@ExcelField(title="承诺的发货时间", align=2, sort=29)
	public Integer getDeliveryTime() {
		return deliveryTime;
	}

	public void setDeliveryTime(Integer deliveryTime) {
		this.deliveryTime = deliveryTime;
	}
	
	@ExcelField(title="承诺的退货时间", align=2, sort=30)
	public Integer getReturnTime() {
		return returnTime;
	}

	public void setReturnTime(Integer returnTime) {
		this.returnTime = returnTime;
	}
	
	@ExcelField(title="承诺的换货时间", align=2, sort=31)
	public Integer getChangeTime() {
		return changeTime;
	}

	public void setChangeTime(Integer changeTime) {
		this.changeTime = changeTime;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="定时上架时间", align=2, sort=32)
	public Date getSaleTime() {
		return saleTime;
	}

	public void setSaleTime(Date saleTime) {
		this.saleTime = saleTime;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="到期下架时间", align=2, sort=33)
	public Date getOffTime() {
		return offTime;
	}

	public void setOffTime(Date offTime) {
		this.offTime = offTime;
	}
	
	@ExcelField(title="默认0,相应积分数", align=2, sort=34)
	public Integer getIntegral() {
		return integral;
	}

	public void setIntegral(Integer integral) {
		this.integral = integral;
	}
	
	@ExcelField(title="商品商家备注，仅商家可见", align=2, sort=35)
	public String getSellerNote() {
		return sellerNote;
	}

	public void setSellerNote(String sellerNote) {
		this.sellerNote = sellerNote;
	}
	
	@ExcelField(title="排序号", align=2, sort=36)
	public Integer getSortNo() {
		return sortNo;
	}

	public void setSortNo(Integer sortNo) {
		this.sortNo = sortNo;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="创建时间", align=2, sort=37)
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@ExcelField(title="创建者", align=2, sort=38)
	public User getCreateBy() {
		return createBy;
	}

	public void setCreateBy(User createBy) {
		this.createBy = createBy;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="更新时间", align=2, sort=39)
	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	@ExcelField(title="更新者", align=2, sort=40)
	public User getUpdateBy() {
		return updateBy;
	}

	public void setUpdateBy(User updateBy) {
		this.updateBy = updateBy;
	}
	
	@ExcelField(title="删除标志", dictType="del_flag", align=2, sort=41)
	public Integer getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(Integer delFlag) {
		this.delFlag = delFlag;
	}

	/**
	 * 插入之前执行方法，需要手动调用
	 */
	public void preInsert(){
		this.id = IdGen.uuid();

		this.updateTime = new Date();
		this.createTime = this.updateTime;
	}

	/**
	 * 更新之前执行方法，需要手动调用
	 */
	public void preUpdate(){
		this.updateTime = new Date();
	}
	/**
	 * 插入之前执行方法，需要手动调用
	 */
	public void preInsert(Date now){
		this.id = IdGen.uuid();

		this.updateTime = now;
		this.createTime = this.updateTime;
	}

	/**
	 * 更新之前执行方法，需要手动调用
	 */
	public void preUpdate(Date now){
		this.updateTime = now;
	}


}